<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * NG Word library class
 *
 */
class Ngword_lib
{
	/**
	 * Constructor
	 *
	 * Load all NG word model.
	 */
	public function __construct()
	{
		$this->CI = &get_instance();

		$this->CI->load->model('pf/ngword/ngword_model');
	}
	
	/**
	 * Check whether the string has ngword
	 *
	 * @param	string	check string
	 * @return	boolean	check result
	 */
	public function has_ngword($str)
	{
		
		$ngwords = $this->CI->ngword_model->get_words();
		
		$filterwords=implode("|",$ngwords);
		if(preg_match("/(".$filterwords.")/i",$str, $match)){
// 			var_dump($match);
			return $match;
		}
		
		return array();
	}
}